package com.zqj.project.factory;

import com.zqj.project.common.database.mybatis.conditions.Wraps;
import com.zqj.project.common.database.mybatis.conditions.query.LbqWrapper;
import com.zqj.project.entity.OrderDetailPO;
import com.zqj.project.model.OrderDetail;

import java.util.Objects;

/**
 * @Description: OrderDetailFactory
 * @Author: 22001010704 Zhang Qijian
 * @CreateTime: 2024/12/8 18:53
 * @Version: 1.0
 */
public class OrderDetailFactory {

    private OrderDetailFactory() {
        throw new IllegalStateException("Utility Class");
    }

    public static LbqWrapper<OrderDetailPO> lbqWrapper(OrderDetail orderDetail) {
        return Wraps.<OrderDetailPO>lbQ().eq(Objects.nonNull(orderDetail.getOrderId()), OrderDetailPO::getOrderId, orderDetail.getOrderId()).eq(Objects.nonNull(orderDetail.getProductId()), OrderDetailPO::getProductId, orderDetail.getProductId()).orderByDesc(OrderDetailPO::getCreateTime);
    }

}